local fangzhu = fk.CreateSkill {

  name = "joy__fangzhu",

  tags = {  },

}



fangzhu:addEffect(fk.Damaged, {
  name = "joy__fangzhu",
  anim_type = "masochism",
  events = {fk.Damaged},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(fangzhu.name)
  end,
  on_cost = function(self, event, target, player, data)
    local to = player.room:askForChoosePlayers(player, table.map(player.room:getOtherPlayers(player), Util.IdMapper), 1, 1, "#joy__fangzhu-choose", fangzhu.name, true)
    if #to > 0 then
      event:setCostData(self, to[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player:broadcastSkillInvoke("fangzhu")
    local to = player.room:getPlayerById(event:getCostData(self))
    to:turnOver()
    if not to.dead then
      to:drawCards(1, fangzhu.name)
    end
  end,
})

return fangzhu